package com.iam.api.controller;

import com.iam.core.base.BaseCommonController;
import com.iam.core.base.BaseCommonService;
import com.iam.core.entities.Result;
import com.iam.api.model.Information;
import com.iam.api.service.InformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
@RequestMapping("/api/information")
public class InformationController extends BaseCommonController<Information> {

    @Autowired
    private InformationService<Information> service;


    @Override
    public BaseCommonService<Information> getiService() {
        return service;
    }

    /**
     * 编辑 更新
     * @param entity
     */
    @PutMapping
    public Result update(@RequestBody Information entity) {
        entity.setUpdateAt(new Date());
        return super.update(entity);
    }

    @Override
    public String getMouduleName() {
        return "资料";
    }
}
